home *** CD-ROM | disk | FTP | other *** search
-
- {
- if(true)
- {
- CShotPatriot = §§newclass(CShotPatriot,CShot);
- }
- }
-
- package Local.Game.Thing
- {
- import Local.Game.World.*;
- import Local.Game.World.Map.*;
- import Local.Game.World.Map.Cell.*;
- import Local.Math.*;
- import STC9.System.*;
- import flash.display.*;
- import flash.events.*;
- import flash.geom.*;
-
- public class CShotPatriot extends CShot
- {
-
-
- private var mPath:CPath;
-
- private var mFlare:CThingAnimation;
-
- public function CShotPatriot(param1:CPosition)
- {
- param1.x = -400;
- param1.y = 100;
- super(param1);
- mType = "patriot";
- Process = Process_Normal;
- mAngle = new CAngle();
- mDelta = new CPosition();
- mMaxLife = mLife = 100;
- mMaxSpeed = 250 * mSpriteScalar;
- mSpeed = 0;
- mAcceleration = 10;
- mOrientation = 1;
- mShowOnMap = true;
- SetTargetting(600,true,FILTER_AirTargets,false);
- AddAnimation("stand",Patriot,"AddSprite_Black");
- SetCollisionBySprite(mAnimation[0]);
- AddThing(mFlare = new CThingAnimation(Patriot_Flare,"AddSprite_Scale"));
- SetState("SEARCHTARGET");
- IncrementFired();
- }
-
- public function State_SEARCHTARGET_Exit() : void
- {
- }
-
- public function State_SEARCHTARGET() : void
- {
- mDelta = CPosition.NORMALIZE(mAngle.mDelta,mSpeed);
- mPosition.Add(mDelta);
- if((mCurrentTarget = GetTarget()) != null)
- {
- SetState("FOLLOWPATH");
- return;
- }
- }
-
- public function State_FOLLOWPATH_Enter() : void
- {
- mPath = new CPath();
- mPath.SetPath([mPosition,new Point((mPosition.x + mCurrentTarget.mPosition.x) / 2,mPosition.y),mCurrentTarget.mPosition]);
- mPath.OrientateThing(this);
- }
-
- public function State_FOLLOWPATH_Exit() : void
- {
- }
-
- public function State_SEARCHTARGET_Enter() : void
- {
- }
-
- public function State_NOPATH() : void
- {
- mDelta = CPosition.NORMALIZE(mAngle.mDelta,mSpeed);
- mPosition.Add(mDelta);
- }
-
- public function CreateExplosion() : void
- {
- Explode();
- AddThing(new CEffectExplosionLarge(mPosition,150));
- DispatchDispose();
- }
-
- override public function Draw() : void
- {
- var _loc1_:Matrix = null;
- var _loc2_:Point = null;
- if(true)
- {
- super.Draw();
- DrawTrail(4,150);
- }
- _loc1_ = GetOrientationMatrix();
- DrawSprite(_loc1_);
- _loc2_ = _loc1_.transformPoint(mSprite.mObjects["flare"].mPosition);
- mFlare.mPosition.SetXY(_loc2_.x + mPosition.x,_loc2_.y + mPosition.y);
- mFlare.mAngle.Copy(mAngle);
- mFlare.Draw();
- }
-
- public function Process_Normal() : void
- {
- var _loc1_:Point = null;
- Accelerate_Speed();
- if(Process_State != null)
- {
- Process_State();
- }
- if(mDisposed)
- {
- return;
- }
- mCollide.Update();
- if(MapMoveTrail())
- {
- if(Process_ReachedObjective())
- {
- return;
- }
- }
- Process_Children();
- _loc1_ = OrientatePoint(mSprite.mObjects["payload"].mPosition.clone(),mPosition);
- if(_loc1_.y >= mLandscape.GetAltitude(_loc1_.x))
- {
- mPosition.SetXY(_loc1_.x,mLandscape.GetAltitude(_loc1_.x));
- CreateExplosion();
- }
- if(mDead)
- {
- DispatchDispose();
- }
- }
-
- public function State_NOPATH_Exit() : void
- {
- }
-
- public function State_NOPATH_Enter() : void
- {
- }
-
- public function State_FOLLOWPATH() : void
- {
- if(true)
- {
- if(!mPath.MoveAlong(mSpeed))
- {
- if(true)
- {
- SetState("NOPATH");
- if(true)
- {
- Process_State();
- if(true)
- {
- return;
- }
- addr34:
- mPath.OrientateThing(this);
- }
- if(Math.abs(mCurrentTarget.mPosition.x - mPosition.x) <= mSpeed / 2)
- {
- }
- §§goto(addr58);
- }
- CreateExplosion();
- §§goto(addr58);
- }
- §§goto(addr34);
- }
- addr58:
- }
- }
- }
-